<?php
 $selected_cat = $query['catid'];
 $selected_cat_setting = array(
    'table_name' => 'cat_news',
    'key_field' => 'id',
    'value_field' => 'title'
);
?>

<div id="content">
	<div id="title_content">Modifier actualité</div>
        <?php echo form_open_multipart('admin_news/update_news/'.$query['id'].'/'.$perpage.'/'.$offset);?>
 	<table class="form_content" width="100%">
             <tr>
                <td>Titre <span style="color:red">*</span></td><td>
               <?php if (form_error('title')!=""){?> <div class="form_error"><?php echo generate_pure_text(form_error('title'), '<p>', '</p>'); ?></div> <?php } ?>
                    <input type="text" name="title" class="form_input" value="<?php echo $query['title']?>"/></td>
             </tr>
             <tr>
                <td>Catégorie <span style="color:red">*</span></td><td>
<?php echo form_dropdown('catid', dropdown_data($selected_cat_setting), $selected_cat) ?>
                </td>
            </tr>
             <tr>
                 <td><img style="border:1px solid #c8c8c8" width="100px" src="<?php echo base_url().'assets/photo_news/thumbs/'.$query['img']; ?>"/></td>
           <td> <input type="file" class="form_input" name="userfile" size="20" />
           </td></tr>
             <tr>
                <td>Contenu <span style="color:red">*</span></td><td>
                  <?php if (form_error('content')!=""){?> <div class="form_error"> <?php echo generate_pure_text(form_error('content'), '<p>', '</p>'); ?></div> <?php } ?>
                    <textarea name="content"><?php echo $query['content']?></textarea>
                </td>
            </tr>

             <tr>
                <td>Meta title </td><td>
               <?php if (form_error('meta_title')!=""){?> <div class="form_error"><?php echo generate_pure_text(form_error('meta_title'), '<p>', '</p>'); ?></div> <?php } ?>
                    <input type="text" name="meta_title" class="form_input" value="<?php echo $query['meta_title'] ?>"/></td>
             </tr>
              <tr>
                <td>Meta description </td><td>
               <?php if (form_error('meta_description')!=""){?> <div class="form_error"><?php echo generate_pure_text(form_error('meta_description'), '<p>', '</p>'); ?></div> <?php } ?>
                    <input type="text" name="meta_description" class="form_input" value="<?php echo $query['meta_description'] ?>"/></td>
             </tr>

              <tr>
                  <td></td><td>
                  <input type="submit" name="submit" class="submit" value="Enregistrer"/>
                   <input type="button" name="button" class="submit" value="Annuler et revenir" onclick="document.location.href='<?php echo site_url('admin_news/list_news').'/'.$perpage.'/'.$offset;?>'"/>
                </td>
            </tr>
        </table>
        </form>
	</div>
<!--END content-->
